| User Guide > How To > Access Results |
The analyze() method returns a populated result containing a barcode results array of objects. Each element of the array contains the result of a single recognized barcode.
|
Copy Code
|
|
|---|---|
// call bx.analyze to detect barcodes in the image // all detected barcodes will be returned to the // result object array. var bx = require('barcode-js'); var params = { input: 'path/filename.ext', type: ['code128', 'code39'] } bx.analyze(params, function(err, results) { if(err) { console.error("There was an error analyzing the barcode", err); return; } else { results.forEach(function(item){ console.log("area: x=%d, y=%d, width=%d, height=%d", item.area.x, item.area.y, item.area.width, item.area.height ); console.log("type: %s", item.type); console.log("value: %s", item.value); console.log("corners: topLeftPoint(%d, %d), topRightPoint(%d, %d), bottomRightPoint(%d, %d), bottomLeftPoint(%d, %d)", item.corners[0].x, item.corners[0].y, item.corners[1].x, item.corners[1].y, item.corners[2].x, item.corners[2].y, item.corners[3].x, item.corners[3].y); console.log("confidence: %d", item.confidence); }) } }); |
|